using EnvDTE80;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using VSAdditionalCommands.ToolWindows.ConstructorToolWindow;
namespace VSAdditionalCommands.Commands
{
    [Command(PackageIds.ConstructorToolWindowCommand)]
    internal sealed class ConstructorToolWindowCommand : BaseCommand<ConstructorToolWindowCommand>
    {
        /// <summary>
        /// Command: скопировать метод на котором каретка в буфер
        /// </summary>
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            await Package.JoinableTaskFactory.SwitchToMainThreadAsync();
            Package.JoinableTaskFactory.RunAsync(async delegate
            {
                ToolWindowPane window = await Package.ShowToolWindowAsync(typeof(ConstructorToolWindow), 0, true, Package.DisposalToken);
                if ((null == window) || (null == window.Frame))
                {
                    throw new NotSupportedException("Cannot create tool window");
                }
            });
        }
    }
}
